home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Commo-Support / File-Archive / flashrom-gamma-01 / cdtv.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-27  |  7.6 KB  |  318 lines

  1. #ifndef CDTV_H
  2. #define CDTV_H
  3. /*
  4. ** CDTV Device Driver Include File
  5. **
  6. **    Copyright (c) 1991 Commodore Electronics Ltd.
  7. **    All rights reserved. Confidential and Proprietary.
  8. **    CDTV is a trademark of Commodore Electronics Ltd.
  9. **
  10. **    Written by: Carl Sassenrath
  11. **                Sassenrath Research, Ukiah, CA
  12. **
  13. **    Version of: March 8, 1991
  14. **                Revised to use new CDTV_ prefix.
  15. **                Old CD_ prefix still works however.
  16. */
  17.  
  18. #ifndef    EXEC_NODES_H
  19. #include <exec/nodes.h>
  20. #endif
  21.  
  22. /*
  23. ** CDTV Device Name
  24. **
  25. **    Name passed to OpenDevice to identify the CDTV device.
  26. */
  27. #define    CDTV_NAME "cdtv.device"
  28.  
  29. /*
  30. ** CDTV Device Driver Commands
  31. */
  32. #define    CDTV_RESET         1
  33. #define    CDTV_READ         2
  34. #define    CDTV_WRITE         3
  35. #define    CDTV_UPDATE         4
  36. #define    CDTV_CLEAR         5
  37. #define    CDTV_STOP         6
  38. #define    CDTV_START         7
  39. #define    CDTV_FLUSH         8
  40. #define    CDTV_MOTOR         9
  41. #define    CDTV_SEEK        10
  42. #define    CDTV_FORMAT        11
  43. #define    CDTV_REMOVE        12
  44. #define    CDTV_CHANGENUM        13
  45. #define    CDTV_CHANGESTATE    14
  46. #define    CDTV_PROTSTATUS        15
  47.  
  48. #define    CDTV_GETDRIVETYPE    18
  49. #define    CDTV_GETNUMTRACKS    19
  50. #define    CDTV_ADDCHANGEINT    20
  51. #define    CDTV_REMCHANGEINT    21
  52. #define    CDTV_GETGEOMETRY    22
  53. #define    CDTV_EJECT        23
  54.  
  55. #define    CDTV_DIRECT        32
  56. #define    CDTV_STATUS        33
  57. #define    CDTV_QUICKSTATUS    34
  58. #define    CDTV_INFO        35
  59. #define    CDTV_ERRORINFO        36
  60. #define    CDTV_ISROM        37
  61. #define    CDTV_OPTIONS        38
  62. #define    CDTV_FRONTPANEL        39
  63. #define    CDTV_FRAMECALL        40
  64. #define    CDTV_FRAMECOUNT        41
  65. #define    CDTV_READXL        42
  66. #define    CDTV_PLAYTRACK        43
  67. #define    CDTV_PLAYLSN        44
  68. #define    CDTV_PLAYMSF        45
  69. #define    CDTV_PLAYSEGSLSN    46
  70. #define    CDTV_PLAYSEGSMSF    47
  71. #define    CDTV_TOCLSN        48
  72. #define    CDTV_TOCMSF        49
  73. #define    CDTV_SUBQLSN        50
  74. #define    CDTV_SUBQMSF        51
  75. #define    CDTV_PAUSE        52
  76. #define    CDTV_STOPPLAY        53
  77. #define    CDTV_POKESEGLSN        54
  78. #define    CDTV_POKESEGMSF        55
  79. #define    CDTV_MUTE        56
  80. #define    CDTV_FADE        57
  81. #define    CDTV_POKEPLAYLSN    58
  82. #define    CDTV_POKEPLAYMSF    59
  83. #define    CDTV_GENLOCK        60
  84.  
  85. /*
  86. ** CDTV Errors
  87. */
  88. #define    CDERR_OPENFAIL    (-1)    /* OpenDevice() failed        */
  89. #define    CDERR_ABORTED    (-2)    /* Command has been aborted    */
  90. #define    CDERR_NOTVALID    (-3)    /* IO request not valid        */
  91. #define    CDERR_NOCMD    (-4)    /* No such command        */
  92. #define    CDERR_BADARG    (-5)    /* Bad command argument        */
  93. #define    CDERR_NODISK    (-6)    /* No disk is present        */
  94. #define    CDERR_WRITEPROT (-7)    /* Disk is write protected    */
  95. #define    CDERR_BADTOC    (-8)    /* Unable to recover TOC    */
  96. #define    CDERR_DMAFAILED    (-9)    /* Read DMA failed        */
  97. #define    CDERR_NOROM    (-10)    /* No CD-ROM track present    */
  98.  
  99. /*
  100. ** LSN/MSF Structures and macros
  101. */
  102. struct RMSF
  103. {
  104.     UBYTE    Reserved;
  105.     UBYTE    Minute;
  106.     UBYTE    Second;
  107.     UBYTE    Frame;
  108. };
  109.  
  110. union LSNMSF
  111. {
  112.     ULONG    Raw;    
  113.     ULONG    LSN;        /* Logical Sector Number    */    
  114.     struct    RMSF MSF;    /* Minute, Second, Frame    */
  115. };
  116.  
  117. typedef union LSNMSF CDPOS;
  118. #define    TOMSF(m,s,f) (((ULONG)(m)<<16)+((s)<<8)+(f))
  119.  
  120. /*
  121. ** CDTV Transfer Lists
  122. **
  123. **    To create transfer lists, use an Exec List or MinList structure
  124. **    and AddHead/AddTail nodes of the transfer structure below.
  125. **    Don't forget to initialize the List/MinList before using it!
  126. **
  127. */
  128. struct    CDXL
  129. {
  130.     struct    MinNode Node;    /* double linkage    */
  131.     char    *Buffer;    /* data (word aligned)    */
  132.     LONG    Length;        /* must be even # bytes    */
  133.     void    (*DoneFunc)();    /* called when done    */
  134.     LONG    Actual;        /* bytes transferred    */
  135. };
  136.  
  137. /*
  138. ** CDTV Audio Segment
  139. **
  140. **    To create segment lists, use an Exec List or MinList structure
  141. **    and AddHead/AddTail nodes with the segment structure below.
  142. **    Don't forget to initialize the List/MinList before using it!
  143. */
  144. struct    CDAudioSeg
  145. {
  146.     struct    MinNode Node;    /* double linkage    */
  147.     CDPOS    Start;        /* starting position    */
  148.     CDPOS    Stop;        /* stopping position    */
  149.     void    (*StartFunc)();    /* function to call on start */
  150.     void    (*StopFunc)();    /* function to call on stop  */
  151. };
  152.  
  153. /*
  154. ** CDTV Table of Contents
  155. **
  156. **    The CD_TOCLSN and CD_TOCMSF comands return an array
  157. **    of this structure.
  158. **
  159. **    Notes:
  160. **
  161. **        The first entry (zero) contains special disk info:
  162. **        the Track field indicates the first track number; the
  163. **        LastTrack field contains the last track number, which is
  164. **        only valid for this first entry; and the Position field
  165. **        indicates the last position (lead out area start) on
  166. **        the disk in MSF format.
  167. */
  168. struct CDTOC
  169. {
  170.     UBYTE    rsvd;        /* not used    */
  171.     UBYTE    AddrCtrl;    /* SubQ info    */
  172.     UBYTE    Track;        /* Track number    */
  173.     UBYTE    LastTrack;    /* Only for entry zero. See note above. */
  174.     CDPOS    Position;
  175. };
  176.  
  177. /*
  178. ** AddrCtrl Values
  179. **
  180. **    These values are returned from both TOC and SUBQ commands.
  181. **    Lower 4 bits are boolean flags. Upper 4 bits are numerical.
  182. */
  183. #define    ADRCTLB_PREEMPH    0    /* audio pre-emphasis    */
  184. #define    ADRCTLB_COPY    1    /* digital copy ok    */
  185. #define    ADRCTLB_DATA    2    /* data track        */
  186. #define    ADRCTLB_4CHAN    3    /* 4 channel audio    */
  187.  
  188. #define    ADRCTLF_PREEMPH    1
  189. #define    ADRCTLF_COPY    2
  190. #define    ADRCTLF_DATA    4
  191. #define    ADRCTLF_4CHAN    8
  192.  
  193. #define    ADRCTL_NOMODE    0x00    /* no mode info        */
  194. #define    ADRCTL_POSITION    0x10    /* position encoded    */
  195. #define    ADRCTL_MEDIACAT    0x20    /* media catalog number    */
  196. #define    ADRCTL_ISRC    0x30    /* ISRC encoded        */
  197. #define    ADRCTL_MASK    0xF0
  198.  
  199. /*
  200. ** CDTV Audio SubQ
  201. */
  202. struct CDSubQ
  203. {
  204.     UBYTE    Status;        /* Audio status */
  205.     UBYTE    AddrCtrl;    /* SubQ info    */
  206.     UBYTE    Track;        /* Track number    */
  207.     UBYTE    Index;        /* Index number    */
  208.     CDPOS    DiskPosition;    /* Position from start of disk  */
  209.     CDPOS    TrackPosition;    /* Position from start of track */
  210.     UBYTE    ValidUPC;    /* Flag for product identifer    */
  211.     UBYTE    pad[3];        /* undefined    */
  212. };
  213.  
  214. /*
  215. ** SubQ Status Values
  216. */
  217. #define    SQSTAT_NOTVALID    0x00    /* audio status not valid    */
  218. #define    SQSTAT_PLAYING    0x11    /* play operation in progress    */
  219. #define    SQSTAT_PAUSED    0x12    /* play is paused        */
  220. #define    SQSTAT_DONE    0x13    /* play completed ok        */
  221. #define    SQSTAT_ERROR    0x14    /* play stopped from error    */
  222. #define    SQSTAT_NOSTAT    0x15    /* no status info        */
  223.  
  224. /*
  225. ** UPC/ISRC Bit Flags
  226. */
  227. #define    SQUPCB_ISRC    0    /* Set for ISRC. Clear for UPC    */
  228. #define    SQUPCB_VALID    7    /* Media catalog detected    */
  229.  
  230. #define    SQUPCF_ISRC    0x01
  231. #define    SQUPCF_VALID    0x80
  232.  
  233. /*
  234. **  Quick-Status Bits
  235. **
  236. **    Bits returned in IO_ACTUAL of the CD_QUICKSTATUS.
  237. */
  238. #define    QSB_READY    0
  239. #define    QSB_AUDIO    2
  240. #define    QSB_DONE    3
  241. #define    QSB_ERROR    4
  242. #define    QSB_SPIN    5
  243. #define    QSB_DISK    6
  244. #define    QSB_INFERR    7
  245.  
  246. #define    QSF_READY    0x01
  247. #define    QSF_AUDIO    0x04
  248. #define    QSF_DONE    0x08
  249. #define    QSF_ERROR    0x10
  250. #define    QSF_SPIN    0x20
  251. #define    QSF_DISK    0x40
  252. #define    QSF_INFERR    0x80
  253.  
  254.  
  255. /*
  256. ** Old CDTV Definitions
  257. **
  258. **    Commodore Product Assurance asks that you
  259. **    not use these command definitions because
  260. **    their CD_ prefix conflicts with that used
  261. **    in the Console device.  Thank you.
  262. */
  263. #define    CD_NAME    "cdtv.device"
  264. #define    CD_RESET         1
  265. #define    CD_READ             2
  266. #define    CD_WRITE         3
  267. #define    CD_UPDATE         4
  268. #define    CD_CLEAR         5
  269. #define    CD_STOP             6
  270. #define    CD_START         7
  271. #define    CD_FLUSH         8
  272. #define    CD_MOTOR         9
  273. #define    CD_SEEK            10
  274. #define    CD_FORMAT        11
  275. #define    CD_REMOVE        12
  276. #define    CD_CHANGENUM        13
  277. #define    CD_CHANGESTATE        14
  278. #define    CD_PROTSTATUS        15
  279.  
  280. #define    CD_GETDRIVETYPE        18
  281. #define    CD_GETNUMTRACKS        19
  282. #define    CD_ADDCHANGEINT        20
  283. #define    CD_REMCHANGEINT        21
  284. #define    CD_GETGEOMETRY        22
  285. #define    CD_EJECT        23
  286.  
  287. #define    CD_DIRECT        32
  288. #define    CD_STATUS        33
  289. #define    CD_QUICKSTATUS        34
  290. #define    CD_INFO            35
  291. #define    CD_ERRORINFO        36
  292. #define    CD_ISROM        37
  293. #define    CD_OPTIONS        38
  294. #define    CD_FRONTPANEL        39
  295. #define    CD_FRAMECALL        40
  296. #define    CD_FRAMECOUNT        41
  297. #define    CD_READXL        42
  298. #define    CD_PLAYTRACK        43
  299. #define    CD_PLAYLSN        44
  300. #define    CD_PLAYMSF        45
  301. #define    CD_PLAYSEGSLSN        46
  302. #define    CD_PLAYSEGSMSF        47
  303. #define    CD_TOCLSN        48
  304. #define    CD_TOCMSF        49
  305. #define    CD_SUBQLSN        50
  306. #define    CD_SUBQMSF        51
  307. #define    CD_PAUSE        52
  308. #define    CD_STOPPLAY        53
  309. #define    CD_POKESEGLSN        54
  310. #define    CD_POKESEGMSF        55
  311. #define    CD_MUTE            56
  312. #define    CD_FADE            57
  313. #define    CD_POKEPLAYLSN        58
  314. #define    CD_POKEPLAYMSF        59
  315. #define    CD_GENLOCK        60
  316.  
  317. #endif    /* CDTV_H */
  318.